﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WinFormsGraphicsDevice;
using Microsoft.Xna.Framework.Graphics;
using TinyEngine.Core.Services;
using TinyEngine.Core.Renderer;
using Microsoft.Xna.Framework;
using TinyEngine.Core.Entities;

namespace TinyEngine.Editor.DefaultPlugins.TileEditor
{
    
    public class TileEntityRenderer: BasicGraphicsDeviceControl
    {
        TileGridEntity entity;
        public TileEntityRenderer()
        {
            
        }

        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
        }

        protected override void Draw()
        {
            base.Draw();

            var sp = ServiceManager.GetService<SpriteBatchService>();
            if (this.entity == null)
                return;

            sp.Batch.Begin();
            entity.Draw(0);
            sp.Batch.End();
        }

        public void SetTileGrid(TileGridEntity ent)
        {
            this.entity = ent;
        }
    }
}
